package serviceImpl;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtil {

	private static EntityManagerFactory emf = null;

	private static void createEntityManagerFactory(){
        if(emf == null){
            emf = Persistence.createEntityManagerFactory("projetoweb");
        }
    }

    public static EntityManager getEntityManager() {
        createEntityManagerFactory();
        return emf.createEntityManager();
    }
}
